﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using System.ComponentModel;
using System.Windows;
using System.Xml.Serialization;

namespace BDSim
{
    /// <summary>
    /// 卫星轨道位置速度结构体
    /// </summary>
    [StructLayout(LayoutKind.Sequential), TypeConverter(typeof(ExpandableObjectConverter))]
    public struct NodePosVel
    {
        /// <summary>
        /// 轨道历元
        /// </summary>
        public UTCTime epoch;

        public double x;

        public double y;

        public double z;

        public double vx;

        public double vy;

        public double vz;

        public double X { get { return x; } set { x = value; } }

        public double Y { get { return y; } set { y = value; } }

        public double Z { get { return z; } set { z = value; } }

        public double VX { get { return vx; } set { vx = value; } }

        public double VY { get { return vy; } set { vy = value; } }

        public double VZ { get { return vz; } set { vz = value; } }

        public UTCTime Epoch { get { return epoch; } set { epoch = value; } }

        public NodePosVel(UTCTime e, double Px, double Py, double Pz, double Vx, double Vy, double Vz)
        {
            epoch = e;
            x = Px;
            y = Py;
            z = Pz;
            vx = Vx;
            vy = Vy;
            vz = Vz;
        }

        public NodePosVel(UTCTime e)
        {
            epoch = e;
            x = y = z = vx = vy = vz = 0;
        }

        public NodePosVel(double Px, double Py, double Pz, double Vx, double Vy, double Vz)
        {
            epoch = new UTCTime();
            x = Px;
            y = Py;
            z = Pz;
            vx = Vx;
            vy = Vy;
            vz = Vz;
        }
    };

    /// <summary>
    /// 卫星轨道位置速度类，用于窗口属性参数设置
    /// </summary>
    [TypeConverter(typeof(ExpandableObjectConverter))]
    public class NodePosVelClass
    {
        /// <summary>
        /// 轨道历元
        /// </summary>
        [XmlIgnore]
        private UTCTimeClass epoch = new UTCTimeClass();

        [XmlAttribute, DescriptionAttribute("初始轨道历元")]
        public UTCTimeClass Epoch
        {
            get { return epoch; }
            set { epoch = value; }
        }

        [XmlIgnore]
        public double x;

        [XmlIgnore]
        public double y;

        [XmlIgnore]
        public double z;

        [XmlIgnore]
        public double vx;

        [XmlIgnore]
        public double vy;

        [XmlIgnore]
        public double vz;

        [XmlAttribute, DescriptionAttribute("卫星X方向初始位置，单位(米)")]
        public double X { get { return x; } set { x = value; } }

        [XmlAttribute, DescriptionAttribute("卫星Y方向初始位置，单位(米)")]
        public double Y { get { return y; } set { y = value; } }

        [XmlAttribute, DescriptionAttribute("卫星Z方向初始位置，单位(米)")]
        public double Z { get { return z; } set { z = value; } }

        [XmlAttribute, DescriptionAttribute("卫星X方向初始速度，单位(米/秒)")]
        public double VX { get { return vx; } set { vx = value; } }

        [XmlAttribute, DescriptionAttribute("卫星Y方向初始速度，单位(米/秒)")]
        public double VY { get { return vy; } set { vy = value; } }

        [XmlAttribute, DescriptionAttribute("卫星Z方向初始速度，单位(米/秒)")]
        public double VZ { get { return vz; } set { vz = value; } }

        public override string ToString()
        {
            return "NodePosVel";
        }

        public NodePosVel ConvertToStruct()
        {
            NodePosVel PosVel = new NodePosVel();
           // PosVel.Epoch.Year = epoch.year;
            PosVel.X = x;
            PosVel.Y = y;
            PosVel.Z = z;
            PosVel.VX = vx;
            PosVel.VY = vy;
            PosVel.VZ = vz;
            return PosVel;
        }
    }

    /// <summary>
    /// 卫星轨道6根数
    /// </summary>
    public struct Orbit6Element
    {
        public UTCTime epoch;			//轨道历元 
        public double a;			// 轨道椭圆的长半轴
        public double e;			// 轨道椭圆的偏心率
        public double O;			// 升交点的赤经
        public double i;			// 轨道面的倾角
        public double w;			// 近地点角距

        public double f;			// 卫星的真近点角


        //public Orbit6Element()
        //{
        //    epoch = new UTCTime();
        //    a = e = O = i = w = f = 0;
        //}
    }

    /// <summary>
    /// 卫星轨道12根数结构体
    /// </summary>
    [StructLayout(LayoutKind.Sequential)]
    public struct Orbit12Element
    {
        /// <summary>
        /// UTC形式的轨道历元
        /// </summary>
        public UTCTime epoch;

        /// <summary>
        /// 轨道椭圆的长半轴
        /// </summary>
        public double a;

        /// <summary>
        /// 轨道椭圆的偏心率
        /// </summary>
        public double e;

        /// <summary>
        /// 升交点的赤经
        /// </summary>
        public double O;

        /// <summary>
        /// 轨道面的倾角
        /// </summary>
        public double i;

        /// <summary>
        /// 近地点角距 
        /// </summary>
        public double w;

        /// <summary>
        /// 卫星的偏近点角
        /// </summary>
        public double E;

        /// <summary>
        /// 卫星的平近点角
        /// </summary>
        public double M;

        /// <summary>
        /// 卫星的真近点角 
        /// </summary>
        public double f;

        /// <summary>
        /// 卫星的升交距角
        /// </summary>
        public double u;

        /// <summary>
        /// 平均轨道角速度
        /// </summary>
        public double n;

        /// <summary>
        /// 卫星经过近地点时间
        /// </summary>
        public double t0;

        /// <summary>
        /// 卫星的初始平近点角
        /// </summary>
        public double M0;
    };

    ///// <summary>
    ///// 卫星轨道根数结构体,与界面交互
    ///// </summary>
    //[TypeConverter(typeof(ExpandableObjectConverter))]
    //public class OrbitSixElementClass
    //{
    //    /// <summary>
    //    /// UTC形式的轨道历元
    //    /// </summary>
    //    public UTCTime t;

    //    /// <summary>
    //    /// 轨道椭圆的长半轴 
    //    /// </summary>
    //    [CategoryAttribute("轨道六根数"), DescriptionAttribute("轨道椭圆的长半轴 ，单位为米（M）"), TypeConverter(typeof(ExpandableObjectConverter))]
    //    public double a { get; set; }

    //    /// <summary>
    //    /// 轨道椭圆的偏心率
    //    /// </summary>
    //    [CategoryAttribute("轨道六根数"), DescriptionAttribute("轨道椭圆的偏心率 "), TypeConverter(typeof(ExpandableObjectConverter))]
    //    public double e { get; set; }

    //    /// <summary>
    //    /// 升交点的赤经
    //    /// </summary>
    //    [CategoryAttribute("轨道六根数"), DescriptionAttribute("升交点的赤经，单位为度 "), TypeConverter(typeof(ExpandableObjectConverter))]
    //    public double O { get; set; }

    //    /// <summary>
    //    /// 轨道面的倾角
    //    /// </summary>
    //    [CategoryAttribute("轨道六根数"), DescriptionAttribute("轨道面的倾角，单位为度 "), TypeConverter(typeof(ExpandableObjectConverter))]
    //    public double i { get; set; }

    //    /// <summary>
    //    /// 近地点角距
    //    /// </summary>
    //    [CategoryAttribute("轨道六根数"), DescriptionAttribute("近地点角距，单位为度 "), TypeConverter(typeof(ExpandableObjectConverter))]
    //    public double w { get; set; }

    //    /// <summary>
    //    /// 卫星的偏近点角
    //    /// </summary>
    //    public double E;

    //    /// <summary>
    //    /// 卫星的平近点角
    //    /// </summary>
    //    public double M;

    //    /// <summary>
    //    /// 卫星的真近点角
    //    /// </summary>
    //    [CategoryAttribute("轨道六根数"), DescriptionAttribute("真近点角，单位为度 "), TypeConverter(typeof(ExpandableObjectConverter))]
    //    public double f { get; set; }

    //    /// <summary>
    //    /// 卫星的升交距角
    //    /// </summary>
    //    public double u;

    //    /// <summary>
    //    /// 平均轨道角速度
    //    /// </summary>
    //    public double n;

    //    /// <summary>
    //    /// 卫星经过近地点时间
    //    /// </summary>
    //    public double t0;

    //    /// <summary>
    //    /// 卫星的初始平近点角
    //    /// </summary>
    //    public double M0;

    //    public override string ToString()
    //    {
    //        return "SatOrbitSixElement";
    //    }
    //}     

    /// <summary>
    /// 卫星轨道根数结构体,与界面交互
    /// </summary>
    [TypeConverter(typeof(ExpandableObjectConverter))]
    public class OrbitSixElementClass
    {
        /// <summary>
        /// UTC形式的轨道历元
        /// </summary>
        public UTCTime epoch;

        /// <summary>
        /// 轨道椭圆的长半轴 
        /// </summary>
        [CategoryAttribute("轨道六根数"), DescriptionAttribute("轨道椭圆的长半轴 ，单位为米（M）"), TypeConverter(typeof(ExpandableObjectConverter))]
        public double a { get; set; }

        /// <summary>
        /// 轨道椭圆的偏心率
        /// </summary>
        [CategoryAttribute("轨道六根数"), DescriptionAttribute("轨道椭圆的偏心率 "), TypeConverter(typeof(ExpandableObjectConverter))]
        public double e { get; set; }

        /// <summary>
        /// 升交点的赤经
        /// </summary>
        [CategoryAttribute("轨道六根数"), DescriptionAttribute("升交点的赤经，单位为度 "), TypeConverter(typeof(ExpandableObjectConverter))]
        public double O { get; set; }

        /// <summary>
        /// 轨道面的倾角
        /// </summary>
        [CategoryAttribute("轨道六根数"), DescriptionAttribute("轨道面的倾角，单位为度 "), TypeConverter(typeof(ExpandableObjectConverter))]
        public double i { get; set; }

        /// <summary>
        /// 近地点角距
        /// </summary>
        [CategoryAttribute("轨道六根数"), DescriptionAttribute("近地点角距，单位为度 "), TypeConverter(typeof(ExpandableObjectConverter))]
        public double w { get; set; }

        /// <summary>
        /// 卫星的真近点角
        /// </summary>
        [CategoryAttribute("轨道六根数"), DescriptionAttribute("真近点角，单位为度 "), TypeConverter(typeof(ExpandableObjectConverter))]
        public double f { get; set; }

        public override string ToString()
        {
            return "SatOrbitSixElement";
        }

        public Orbit6Element ConvertToStruct()
        {
            Orbit6Element Ele = new Orbit6Element();
            Ele.epoch = epoch;
            Ele.a = a;
            Ele.e = e;
            Ele.f = f;
            Ele.i = i;
            Ele.O = O;
            Ele.w = w;
            return Ele;
        }
    }     

    /// <summary>
    /// 卫星位置的坐标类型
    /// </summary>
    public enum SatPosType
    {
        CGCS2000,
        J2000,
        六根数
    }

    /// <summary>
    /// 星座类型
    /// </summary>
    public enum EConstellationType
    {
        /// <summary>
        /// 北斗星座
        /// </summary>
        BDS,
        /// <summary>
        /// GPS星座
        /// </summary>
        GPS,
        /// <summary>
        /// 格洛纳斯星座
        /// </summary>
        GLONASS,
        /// <summary>
        /// 伽利略星座
        /// </summary>
        GALILEO,
    }

    /// <summary>
    /// 卫星类型
    /// </summary>
    public enum EOrbitType
    {
        GEO,
        MEO,
        IGSO,
    }

    /// <summary>
    /// 星历16参
    /// </summary>
    public struct SixTeen_Ephemeris
    {
        /// <summary>
        /// toe对应的UTC时间
        /// </summary>
        public UTCTime t;
        public double toe;
        public double sqrtA;
        public double e;
        public double i;
        public double Omega0;
        public double w;
        public double M;
        public double deltaN;
        public double OmegaDot;
        public double idot;
        public double Crs;
        public double Crc;
        public double Cus;
        public double Cuc;
        public double Cis;
        public double Cic;

        public SixTeen_Ephemeris(UTCTime pt, double ptoe, double psqrtA, double pe, double pi, double pOmega0, double pw, double pM, double pdeltaN,
            double pOmegaDot, double pidot, double pCrs, double pCrc, double pCus, double pCuc, double pCis, double pCic)
        {
            t = pt;
            toe = ptoe;
            sqrtA = psqrtA;
            e = pe;
            i = pi;
            Omega0 = pOmega0;
            w = pw;
            M = pw;
            deltaN = pdeltaN;
            OmegaDot = pOmega0;
            idot = pidot;
            Crs = pCrs;
            Crc = pCrc;
            Cus = pCus;
            Cuc = pCuc;
            Cis = pCis;
            Cic = pCic;
        }
    };
  
    /// <summary>
    /// 轨道动力学配置参数类，用于界面设置
    /// </summary>
    [TypeConverter(typeof(ExpandableObjectConverter))]
    public class OrbitPredictParamClass
    {
        #region 字段        

        /// <summary>
        /// 
        /// </summary>
        private EPropagateType _PropagateType;

        /// <summary>
        /// 卫星等效横截面积；界面输入
        /// </summary>
        private double _SatArea;

        /// <summary>
        /// 卫星质量；界面输入
        /// </summary>
        private double _SatMass;

        /// <summary>
        /// 非球形摄动；界面输入
        /// </summary>
        private byte _NonSphPert;

        /// <summary>
        /// 引力场模型
        /// </summary>
        private EEarthPotentialModel _EarthPotentialModel;

        /// <summary>
        /// 引力场模型最高阶数；界面输入
        /// </summary>
        private int _EarthPotentialM;

        /// <summary>
        /// 引力场模型最高次数；界面输入
        /// </summary>
        private int _EarthPotentialN;

        /// <summary>
        /// 太阳引力摄动控制参数；界面输入
        /// </summary>
        private byte _SunPert;

        /// <summary>
        /// 月球引力摄动控制参数；界面输入
        /// </summary>
        private byte _MoonPert;
        
        /// <summary>
        /// 太阳光压摄动控制参数；界面输入
        /// </summary>
        private byte _SunSrpPert;

        /// <summary>
        /// 太阳光压模型选择0:3参数球模型；1:6参数模型；2:9参数模型；
        /// </summary>
        private int _SunSrpModel;

        /// <summary>
        /// 阴影模型选取标志，0-不考虑，1-柱形模型，2-椎形模型；界面输入
        /// </summary>
        private int _ShadModelTag;

        /// <summary>
        /// 太阳光压参数（9参）；界面输入
        /// </summary>
        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 9)]
        private double[] _SunSrpParam;
        
        /// <summary>
        /// ROCK模型选择，1: ROCK T MODEL (T10, T20, T30)，2: ROCK S MODEL (S10, S20) ，8: CODE MODEL (9801) ， 9: JPL MODEL (GPS_XYZ)
        /// </summary>
        private int _ROCKM;
        
        /// <summary>
        /// BLOCK模型，1: BLOCK I， 2: BLOCK II，3: BLOCK IIA，4: BLOCK IIR，5: BLOCK IIF
        /// </summary>
        private int _BLOCK;

        /// <summary>
        /// ROCK模型参数
        /// </summary>
        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 9)]
        private double[] _P02RAD;

        /// <summary>
        /// 相对论效应控制参数；0：开关关闭，不考虑；其他值，开关打开，考虑相对论效应摄动
        /// </summary>
        private int _Rel;
                
        /// <summary>
        /// 固体潮汐摄动控制开关，0：不考虑；其他值，开关打开，考虑固体潮汐摄动
        /// </summary>
        private int _Tide;

        #endregion

        #region 属性

        public EPropagateType PropagateType
        {
            get { return _PropagateType; }
            set { _PropagateType = value; }
        }

        /// <summary>
        ///卫星等效横截面积,单位(㎡) 
        /// </summary>
        [DescriptionAttribute("卫星等效横截面积,单位(㎡)")]
        public double SatArea
        {
            get { return _SatArea; }
            set
            {
                if (value >= 0)
                {
                    _SatArea = value;
                }
            }
        }

        /// <summary>
        /// 卫星质量,单位(kg)
        /// </summary>
        [DescriptionAttribute("卫星质量,单位(kg)")]
        public double SatMass
        {
            get { return _SatMass; }
            set
            {
                if (value >= 0)
                {
                    _SatMass = value;
                }
            }
        }

        /// <summary>
        /// 非球形摄动
        /// </summary>
        [DescriptionAttribute("非球形摄动")]
        public byte NonSphPert
        {
            get { return _NonSphPert; }
            set { _NonSphPert = value; }
        }

        /// <summary>
        /// 引力场模型
        /// </summary>
        [DescriptionAttribute("地球引力场模型")]
        public EEarthPotentialModel EarthPotentialModel
        {
            get { return _EarthPotentialModel; }
            set { _EarthPotentialModel = value; }
        }

        /// <summary>
        /// 引力场模型最高阶数
        /// </summary>
        [DescriptionAttribute("田谐项最高阶数")]
        public int EarthPotentialM
        {
            get { return _EarthPotentialM; }
            set
            {
                if (value < 0 || value > 10)
                {
                    MessageBox.Show("田谐项最高次数需设置在[0,10]之间!");
                }
                else if (value < _EarthPotentialN)
                {
                    MessageBox.Show("SphFiledM应大于等于SphFiledN");
                }
                else
                {
                    _EarthPotentialM = value;
                }
            }
        }

        /// <summary>
        /// 引力场模型最高次数
        /// </summary>
        [DescriptionAttribute("田谐项最高次数")]
        public int EarthPotentialN
        {
            get { return _EarthPotentialN; }
            set
            {
                if (value > _EarthPotentialM)
                {
                    MessageBox.Show("SphFiledN应小于等于SphFiledM");
                }
                else
                {
                    _EarthPotentialN = value;
                }
            }
        }

        /// <summary>
        /// 太阳引力摄动控制参数
        /// </summary>
        [DescriptionAttribute("地球引力摄动控制参数")]
        public byte SunPert
        {
            get { return _SunPert; }
            set { _SunPert = value; }
        }

        /// <summary>
        /// 月球引力摄动控制参数
        /// </summary>
        [DescriptionAttribute("月球引力摄动控制参数")]
        public byte MoonPert
        {
            get { return _MoonPert; }
            set { _MoonPert = value; }
        }

        /// <summary>
        /// 太阳光压摄动控制参数
        /// </summary>
        [DescriptionAttribute("太阳光压摄动控制参数")]
        public byte SunSrpPert
        {
            get { return _SunSrpPert; }
            set { _SunSrpPert = value; }
        }

        /// <summary>
        ///太阳光压模型选择0:3参数球模型；1:6参数模型；2:9参数模型 
        /// </summary>
        [DescriptionAttribute("太阳光压模型选择0:3参数球模型；1:6参数模型；2:9参数模型")]
        public int SunSrpModel
        {
            get { return _SunSrpModel; }
            set
            {
                if (value >= 0 && value <= 2)
                {
                    _SunSrpModel = value;
                }
            }
        }

        /// <summary>
        /// 阴影模型选取标志，0-不考虑，1-柱形模型，2-椎形模型
        /// </summary>
        [DescriptionAttribute("阴影模型选取标志，0-不考虑，1-柱形模型，2-椎形模型")]
        public int ShadModelTag
        {
            get { return _ShadModelTag; }
            set
            {
                if (value >= 0 && value <= 2)
                {
                    _ShadModelTag = value;
                }
            }
        }

        /// <summary>
        /// 太阳光压参数（9参）
        /// </summary>
        [ DescriptionAttribute("太阳光压参数（9参）"), DisplayName("SunSrpParam")]
        public double[] SunRprParam
        {
            get { return _SunSrpParam; }
            set { _SunSrpParam = value; }
        }

        /// <summary>
        /// ROCK模型选择
        /// </summary>
        [DescriptionAttribute("ROCK模型选择，1: ROCK T MODEL (T10, T20, T30)，2: ROCK S MODEL (S10, S20) ，8: CODE MODEL (9801) ， 9: JPL MODEL (GPS_XYZ)")]
        public int ROCKM
        {
            get { return _ROCKM; }
            set { _ROCKM = value; }
        }

        /// <summary>
        /// BLOCK模型，1: BLOCK I， 2: BLOCK II，3: BLOCK IIA，4: BLOCK IIR，5: BLOCK IIF
        /// </summary>
        [DescriptionAttribute("BLOCK模型，1: BLOCK I， 2: BLOCK II，3: BLOCK IIA，4: BLOCK IIR，5: BLOCK IIF")]
        public int BLOCK
        {
            get { return _BLOCK; }
            set { _BLOCK = value; }
        }

        /// <summary>
        /// ROCK模型参数
        /// </summary>
        [DescriptionAttribute("ROCK模型参数")]
        public double[] P02RAD
        {
            get { return _P02RAD; }
            set { _P02RAD = value; }
        }

        [DescriptionAttribute("相对论效应控制参数；0：开关关闭，不考虑；其他值，开关打开，考虑相对论效应摄动")]
        public int Rel
        {
            get { return _Rel; }
            set { _Rel = value; }
        }

        /// <summary>
        /// 固体潮汐摄动控制开关，0：不考虑；其他值，开关打开，考虑固体潮汐摄动
        /// </summary>
        [DescriptionAttribute(" 固体潮汐摄动控制开关，0：不考虑；其他值，开关打开，考虑固体潮汐摄动")]
        public int Tide
        {
            get { return _Tide; }
            set { _Tide = value; }
        }      

        #endregion

        public OrbitPredict_Param ConvertToStruct()
        {
            OrbitPredict_Param newParam = new OrbitPredict_Param();

            //赋值的过程
            newParam.m_BLOCK = this._BLOCK;
            newParam.m_bMoonPert = this.MoonPert;
            newParam.m_bNonSphPert = NonSphPert;
            newParam.m_bSrpPert = SunSrpPert;
            newParam.m_bSunPert = SunPert;
            newParam.m_LeapSec = 36;
            newParam.m_nSHADModel = ShadModelTag;
            newParam.m_nSphFiledM = EarthPotentialM;
            newParam.m_nSphFiledN = EarthPotentialN;
            newParam.m_nSPRModel = SunSrpModel;
            newParam.m_orbit = new NodePosVel()
            {
                Epoch = new UTCTime() { year = 2015, mon = 10, day = 1, hour = 12, min = 0, sec = 0 },
                x = 16983361.4247804990,
                y = -20353706.4413478,
                z = -0.00155838616757,
                vx = 1709.450048999987,
                vy = 1426.384334400012,
                vz = 3179.607803900002
            };
            newParam.m_rel = Rel;
            newParam.SRP = SunRprParam;
            newParam.m_Sat_Mass = SatMass;
            newParam.m_P02RAD = P02RAD;
            newParam.m_Sat_Area = SatArea;
            return newParam;
        }
    }

    /// <summary>
    /// 轨道后插表
    /// </summary>
    public struct BackDiff
    {
        /// <summary>
        /// 积分步长
        /// </summary>
        public double step;

        /// <summary>
        /// 积分结束时刻
        /// </summary>
        public double timeOfEnd;

        /// <summary>
        /// 卫星位置
        /// </summary>
        public double x, y, z;

        /// <summary>
        /// 卫星速度
        /// </summary>
        public double vx, vy, vz;

        /// <summary>
        /// 后差表
        /// </summary>
        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 42)]
        public double[] diff;
    };

    public enum EPropagateType
    {
        TwoBody,
        HPOP
    }

    public enum EEarthPotentialModel
    {
        JGM3,
        TEG4,
        EIGEN2
    }

    /// <summary>
    /// 积分器类型
    /// </summary>
    public enum EIntegratorType
    {
        RKF7,
        KSG
    }

    /// <summary>
    /// 积分器设置
    /// </summary> 
    public class IntegrationParamClass
    {
        #region 字段

        /// <summary>
        /// 积分器类型
        /// </summary>
        private EIntegratorType _Integration;

        /// <summary>
        /// 积分步长
        /// </summary>
        private int _StepSize=60;

        #endregion

        #region 属性

        public EIntegratorType Integration
        {
            get { return _Integration; }
            set { _Integration = value; }
        }

        public int StepSize
        {
            get { return _StepSize; }
            set { _StepSize = value; }
        }

        #endregion

    }

    #region 卫星轨道动态库增加结构体

    [StructLayout(LayoutKind.Sequential)]
    public struct SimParam
    {
        /// <summary>
        /// 记录当前仿真步数计数，从0开始
        /// </summary>
        public int simClks;

        /// <summary>
        /// 仿真步长（4）单位为微秒
        /// </summary>
        public int simStepInt;
        public UTCTime pStartTime;
    };

    /// <summary>
    /// 轨道预报输入
    /// </summary>
    public struct OrbitPredict_Input
    {
        //输入时间，相对时间(单位：s)相对于积分器初始轨道点状态的历元时间
        public double startTime;
        //输出时间，相对时间(单位：s)相对于积分器初始轨道点状态的历元时间		
        public double endTime;
        //积分器步长；界面输入		
        public double step;
        //上一步积分结果
        public BackDiff presatdf;
    }

    /// <summary>
    /// 轨道预报参数
    /// </summary>
    public struct OrbitPredict_Param
    {
        //卫星编号；
        public int SatID;
        //卫星类型，0-未知,1-MEO,2-IGSO3-GEO；			
        public int m_Sat_nType;
        //卫星等效横截面积；
        public double m_Sat_Area;
        //卫星质量；
        public double m_Sat_Mass;

        //非球形摄动；
        public int m_bNonSphPert;
        //田谐项最高阶数；
        public int m_nSphFiledM;
        //田谐项最高次数；	
        public int m_nSphFiledN;

        //太阳引力摄动控制参数；	
        public int m_bSunPert;
        //月球引力摄动控制参数；
        public int m_bMoonPert;
        //太阳光压摄动控制参数；
        public int m_bSrpPert;

        //太阳光压模型选择0:3参数球模型；1:6参数模型；2:9参数模型；
        public int m_nSPRModel;
        //阴影模型选取标志，0-不考虑，1-柱形模型，2-椎形模型；界面输入
        public int m_nSHADModel;
        //太阳光压参数（9参）；一定要赋初值，如果是3参球模型，一般SRP[0]=1，SRP[1~8]={0}；如果是9参模型，可读模型文件获取系数（lhz）
        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 9)]
        public double[] SRP;
        //ROCK模型选择，1: ROCK T MODEL (T10, T20, T30)，2: ROCK S MODEL (S10, S20) ，8: CODE MODEL (9801) ， 9: JPL MODEL (GPS_XYZ)
        public int m_ROCKM;
        //BLOCK模型，1: BLOCK I， 2: BLOCK II，3: BLOCK IIA，4: BLOCK IIR，5: BLOCK IIF
        public int m_BLOCK;
        //前两个模型的参数			
        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
        public double[] m_P02RAD;
        //相对论效应控制参数；0：开关关闭，不考虑；其他值，开关打开，考虑相对论效应摄动
        public int m_rel;
        // 固体潮汐摄动控制开关，0：不考虑；其他值，开关打开，考虑固体潮汐摄动           
        public int m_tide;
        //初始化积分器时的位置速度(ECI)
        public NodePosVel m_orbit;
        //积分器使用的跳秒值
        public double m_LeapSec;

    }

    /// <summary>
    /// 轨道预报输出
    /// </summary>
    public struct OrbitPredict_Output
    {
        //轨道积分结果；
        public BackDiff satdf;
    }
    #endregion 卫星轨道动态库增加结构体


    /// <summary>
    /// 单颗卫星导航电文参数(目前无电离层)
    /// </summary>
    public struct NavMessage
    {
        //卫星编号
        public int SatID;

        //钟差参数
        public double toc;
        public double a0;
        public double a1;
        public double a2;

        //星历参数
        public double toe;
        public double sqrtA;
        public double e;
        public double i;
        public double Omega0;
        public double w;
        public double M;
        public double deltaN;
        public double OmegaDot;
        public double idot;
        public double Crs;
        public double Crc;
        public double Cus;
        public double Cuc;
        public double Cis;
        public double Cic;
    }
}
